namespace QMVnSoft.Controls
{
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormNotDeletes : FormControl
    {
        private DataGridViewTextBoxColumn Column1;
        private DataGridViewTextBoxColumn Column2;
        private DataGridViewTextBoxColumn Column3;
        private IContainer components;
        private GridControl gridControl;
        private DataTable oNotDeleteDataTable;

        public FormNotDeletes(string ps_WarningMessage, DataTable po_NotDeleteDataTable)
        {
            this.InitializeComponent();
            this.WarningMessage = ps_WarningMessage;
            this.NotDeleteDataTable = po_NotDeleteDataTable;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormNotDeletes));
            this.gridControl = new QMVnSoft.Controls.GridControl();
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            ((System.ComponentModel.ISupportInitialize)(this.gridControl)).BeginInit();
            this.SuspendLayout();
            // 
            // gridControl
            // 
            this.gridControl.AllowUserToAddRows = false;
            this.gridControl.AllowUserToDeleteRows = false;
            this.gridControl.CheckAutoSize = true;
            this.gridControl.CheckColor = false;
            this.gridControl.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.gridControl.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column1,
            this.Column2,
            this.Column3});
            this.gridControl.Dock = System.Windows.Forms.DockStyle.Fill;
            this.gridControl.Font = new System.Drawing.Font("Arial", 8.25F);
            this.gridControl.Location = new System.Drawing.Point(0, 0);
            this.gridControl.Name = "gridControl";
            this.gridControl.ReadOnly = true;
            this.gridControl.Size = new System.Drawing.Size(452, 251);
            this.gridControl.TabIndex = 0;
            // 
            // Column1
            // 
            this.Column1.DataPropertyName = "Ngay_Ct";
            this.Column1.HeaderText = "Ngày";
            this.Column1.Name = "Column1";
            this.Column1.ReadOnly = true;
            this.Column1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
            this.Column1.Width = 62;
            // 
            // Column2
            // 
            this.Column2.DataPropertyName = "So_Ct";
            this.Column2.HeaderText = "Số";
            this.Column2.Name = "Column2";
            this.Column2.ReadOnly = true;
            this.Column2.Width = 70;
            // 
            // Column3
            // 
            this.Column3.DataPropertyName = "Dien_Giai";
            this.Column3.HeaderText = "Thông báo";
            this.Column3.Name = "Column3";
            this.Column3.ReadOnly = true;
            this.Column3.Width = 277;
            // 
            // FormNotDeletes
            // 
            this.ClientSize = new System.Drawing.Size(452, 251);
            this.Controls.Add(this.gridControl);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FormNotDeletes";
            ((System.ComponentModel.ISupportInitialize)(this.gridControl)).EndInit();
            this.ResumeLayout(false);

        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Escape)
            {
                base.Close();
                return false;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        public DataTable NotDeleteDataTable
        {
            set
            {
                this.oNotDeleteDataTable = value;
                this.gridControl.AutoGenerateColumns = false;
                this.gridControl.DataSource = new BindingSource(this.oNotDeleteDataTable, this.oNotDeleteDataTable.TableName);
                ((BindingSource) this.gridControl.DataSource).Sort = "Ngay_Ct, So_Ct";
            }
        }

        public string WarningMessage
        {
            set
            {
                this.Text = value;
            }
        }
    }
}

